//
//  SNThemeItemViewController.m
//  DayDayHappy
//
//  Created by yutao on 14-3-12.
//  Copyright (c) 2014年 yutao. All rights reserved.
//

#import "SNThemeItemViewController.h"

@interface SNThemeItemViewController ()

@end

@implementation SNThemeItemViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    self.requestUrl = [NSString stringWithFormat:@"%@%@?id=%@",kBaseUrl,kGetTheme,self.themeId];
    [super viewDidLoad];
    
    self.title = @"主题";
    
    [self initBackBarButton];
    
    if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0")) {
        self.contentTableView.frame  =  CGRectMake(0, 0, CGRectGetWidth([UIScreen mainScreen].bounds), CGRectGetHeight([UIScreen mainScreen].bounds));
    }else{
        self.contentTableView.frame  =CGRectMake(0, 0, CGRectGetWidth([UIScreen mainScreen].bounds), CGRectGetHeight([UIScreen mainScreen].bounds) - ( CGRectGetHeight(self.navigationController.navigationBar.frame))  -20);
    }
}

- (void)initBackBarButton
{
    
    self.navigationItem.leftBarButtonItem = nil;
    UIButton * backBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [backBtn setFrame:CGRectMake(15, 0, 60, 40)];
    [backBtn setBackgroundImage:[UIImage imageNamed:@"back.png"] forState:UIControlStateNormal];
    [backBtn addTarget:self action:@selector(goBack) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem *menuBarButton = [[UIBarButtonItem alloc] initWithCustomView:backBtn];
    self.navigationItem.leftBarButtonItem = menuBarButton;
}

- (void)goBack
{
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
